import axios from 'axios'

export default {
  async getYearsList (studentId) {
    let result = await axios({
      url: '/studentevaluation/api/student/get_years/' + studentId,
      method: 'get'
    })
    result = result.data
    if (result.code === -1) {
      alert('服务器出错：' + result.msg + ', 请稍后再试')
      return null
    }
    result = result.data
    return result
  },
  async getCheckTable (name, studentId, college, activityYear) {
    let result = await axios({
      url: '/studentevaluation/api/student/get_rewardtable',
      method: 'get',
      params: {
        name: name,
        studentId: studentId,
        college: college,
        activityYear: activityYear
      }
    })
    result = result.data
    if (result.code === -1) {
      // alert('服务器出错：' + result.msg + ', 请稍后再试')
      return {
        firstList: [],
        secondList: [],
        thirdList: []
      }
    }
    result = result.data
    return result
  },
  async addStudent (studentId, name, college) {
    let result = await axios({
      url: '/studentevaluation/api/student/',
      method: 'post',
      data: {
        name: name,
        studentId: studentId,
        college: college
      }
    })
    return result
  }
}
